<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition 
    template="/template/templatePadrao.xhtml"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    xmlns:f="http://xmlns.jcp.org/jsf/core">
    <ui:define name="conteudoCentro">
        <h:form  id="formColheita">
            <p:messages id="mColheita" showDetail="true"/>
            <p:panel id="imPanelColheita" header="Colheita" style="text-align: center">
                <center>
                    <h:inputHidden 
                        id="imIHColheita" 
                        value=""/>
                    <h:panelGrid id="imGridColheita" columns="2">
                        <p:outputLabel for="calendario" value="Calendário:" />
                        <p:calendar id="calendario" value="#{colheitaBean.colheita.dataColheita}" pattern="dd-MM-yyyy" mask="true" />
                        <h:outputText value="Local:"/>
                        <p:selectOneMenu id="soLocal" 
                                         value="#{colheitaBean.colheita.local}" 
                                         converter="localConversor"
                                         effect="fade" 
                                         var="t" 
                                         filter="true" 
                                         filterMatchMode="startsWith">
                            <f:selectItems value="#{localBean.listaLocais}" var="p" itemLabel="#{p.nome}" itemValue="#{p}" />

                            <p:column headerText="Nome:">
                                <h:outputText value="#{t.nome}" />
                            </p:column>

                        </p:selectOneMenu>
                        <h:outputText value="Peso:"
                                      title="Quantidade aproximada de açaí colhido"/>
                        <p:inputText
                            id="itPeso" 
                            value="#{colheitaBean.colheita.peso}"                      
                            />
                        <h:outputText value="Observação:"
                                      title="Informações chave para detalhar a safra."/>
                        <p:inputText
                            id="itObservacao" 
                            value="#{colheitaBean.colheita.observacao}"
                            />
                    </h:panelGrid>

                    <p:commandButton
                        id="imSalvar"
                        ajax="false"
                        icon="ui-icon-check"
                        value="Salvar"
                        update="formColheita"
                        action="#{colheitaBean.salvar()}"/>
                    <p:button
                        id="imCancelar"
                        icon="ui-icon-closethick"
                        value="Cancelar"
                        href="/sistema/inicio.jsf"
                        />
                </center>
            </p:panel>
        </h:form>
    </ui:define>
</ui:composition>

